home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
19
/
8
/
DISK1982.ZIP
/
CH2_1.DOC
< prev
next >
Wrap
Text File
|
1991-03-15
|
30KB
|
1,075 lines
..pgno01
..foot60A2-##
..head02L──────────────────────────────────────────────────────────────────────
..head04L──────────────────────────────────────────────────────────────────────
..head03LDeclarations
Type
TSet = Set Of 0..255;
Var
CheckSnow : Boolean used to enable or disable snow-checking when
reading or writing data directly to video
memory.
TextAttr : Byte global variable that contains the currently
selected video attribute.
InsMode : Byte global variable used by EditSt to indicate if
the cursor is in insert or overwrite mode.
VioBaseSeg : Word contains the base segment address of the
current video page.
VioCols : Word contains the screen width which is the total
number of characters per line.
VioCursor : Word contains the size of the cursor with the
starting scan line in the high byte and the
ending scan line in the low byte.
VioPage : Word contains the active video page in use. The
value should always be zero for a monochrome
adapter.
WindMax : Word used for the lower right corner of the window
that is currenlty defined thru the use of the
Window function.
WindMin : Word used for the upper left corner of the window
that is currently defined thru the use of the
Window function.
..page
..head03ABorderColor
■ Description
Sets the color for the border screen.
■ Summary
Procedure BorderColor( Color : Integer );
Color defines the color of the border screen.
■ Remarks
The following colors are allowed for the border color if you have a
Color/Graphics Monitor Adapter. BorderColor does not have any
effect on a monochrome display.
0 Black 8 Gray
1 Blue 9 Light Blue
2 Green 10 Light Green
3 Cyan 11 Light Cyan
4 Red 12 Light Red
5 Magenta 13 Light Magenta
6 Brown 14 Yellow
7 White 15 High-intensity White
■ Example
Program Example;
Uses FPVideo;
Var
i,j : Integer;
Begin
For i := 0 To 15 Do Begin
BorderColor( i );
j := GetKey();
End;
End.
In this example the sixteen available colors for the border will be
displayed. A new color will be displayed each time a key is pressed.
..page
..head03AClrWin
■ Description
Clear window area with the specified color.
■ Summary
Procedure ClrWin( x1, y1, x2, y2, Attr : Integer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Attr integer in the range 0-255 defining the foreground and
background byte combination for the color of the window.
■ Remarks
This procedure will blank the window area for the window coordinates
that are passed. ClrWin does not move the cursor from its current
position.
■ Example
Program Example;
Uses FPVideo;
Begin
ClrWin( 5, 5, 40, 20, 7 );
End.
When ClrWin is called in this example the window area (5,5,40,20)
will be cleared with the attribute value of 7.
..page
..head03AColorMsg
■ Description
Display string on the screen using the color attribute specified.
■ Summary
Procedure ColorMsg( x, y, Attr : Integer; Message : String );
x column to begin display of message.
y row to begin display of message.
Attr integer in the range 0-255. It is the color to use for
displaying the message.
Message string message to be displayed.
■ Remarks
ColorMsg is NOT sensitive to Turbo's currently defined window and
will wrap around to column one on the next line of the screen when
necessary. ColorMsg will not scroll the screen if the data to be
displayed is to extend beyond the last row of the screen.
■ See Also
DspMsg, WriteSt, WriteStln
..page
■ Example
Program Example;
Uses FPVideo;
Var
p : String;
st : String;
i : Integer;
Begin
ClrWin( 1, 1, 80, 25, 7 );
St := 'Color-line';
For i := 0 To 8 Do Begin
Str( i:1, p );
ColorMsg( 1, i+1, 1+i, St + p );
ColorMsg( 1, i+10, 48+i, St + p );
End;
End.
This program example will display nine lines on the upper and lower
half of the screen. The upper half of the screen will display black
as the background color. The lower half will use cyan as the
background color.
..page
..head03ADspMsg
■ Description
Display string on the screen without changing the color attribute
that is currently on the display screen.
■ Summary
Procedure DspMsg( x, y : Integer; Message : String );
x column to begin display of message.
y row to begin display of message.
Message string message to display.
■ Remarks
DspMsg is NOT sensitive to Turbo's currently defined window and will
wrap around to column one on the next line of the screen when
necessary. DspMsg will not scroll the screen if the data to be
displayed is to extend beyond the last row of the screen.
■ See Also
ColorMsg, WriteSt, WriteStln
■ Example
Program Example;
Uses FPVideo;
Var
i : Integer;
Begin
ClrWin( 1, 1, 80, 25, 7 );
For i := 1 To 25 Do
FillRowAttr( 1, i, 80, i );
For i := 1 To 25 Do
DspMsg( 1, i, 'This is a test message' );
End.
This program example will display a different attribute color to
each row of the display, then a message will be displayed on each
line without changing the attribute bytes that already exist on the
screen.
..page
..head03AEditSt
■ Description
Edit an existing or null string from the keyboard.
■ Summary
Procedure EditSt( Row : Integer;
StCol : Integer;
SpCol : Integer;
Len : Integer;
CharCase : Integer;
FillCh : Integer;
AutoSkip : Integer;
ErrTone : Integer;
ErrDur : Integer;
VCSet : TSet;
TCSet : TSet;
Var ChOfs : Integer;
Var TE : Integer;
Var St : String );
Row defines row to edit string on.
StCol defines left or start column of field to edit. This
value must be less than or equal to SpCol.
SpCol defines right or stop column of the field to edit. This
value must be greater than or equal to StCol.
Len integer in the range of 1-255. It is the maximum length
of the string to be edited.
CharCase integer in the range 1-3. The Case Mode indicator
defines how a character is displayed on the screen and
stored in the string variable being edited.
1 = Do nothing to character
2 = Convert all characters to upper case
3 = Convert all characters to lower case
FillCh integer in the range of 0-255. This defines the ascii
character that is displayed in the field for undefined
character positions in the field being edited.
AutoSkip integer indicating if an auto exit is desired when the
last character in the field has been typed.
0 - No auto exit
1 - Auto exit after last character in field is
entered.
..page
ErrTone integer in units giving the frequency for beeping the
speaker.
ErrDur integer in units giving the length of time the speaker
is to beep.
VCSet set of valid characters, [0..255], that will be accepted
for data entry.
TCSet set of extended keyboard characters, [0..255], that are
allowed to terminate this procedure. (Refer to appendix
C for a listing of these codes.)
CharOfs an integer that indicates the beginning cursor position
within the string. If CharOfs is a 1 then editing will
begin in the first column of the field input area. If
CharOfs is 256 or greater than the length of the string
to be edited, the cursor will be positioned after the
last character in the string. On exit from EditSt
CharOfs will contain the cursor position within the
string.
TE is the terminating element number that terminated the
string input procedure. TE will be in the range of 0-255
which corresponds to the element number in appendix C.
St string buffer area to receive the input data.
■ Remarks
The maximum length of the string to edit is 255 characters. The
data will be entered on one line. If the maximum length of the
string exceeds the number of display columns, SpCol - StCol + 1, the
string will scroll horizontally on the screen within the StCol and
SpCol columns.
..page
Editing Keys:
The following gives an explanation of the editing keys that may be
used with EditSt, provided the key pressed is not defined in the
terminating character set. EditSt calls the function GetKey, in
the unit SSGetKey, which returns an integer. This integer is a
value from 0-384 which corresponds to an element number that is
defined in Appendix C. The function GetKey is provided with a
table that maps the key element numbers to the index number.
Example, If the cursor is to move right one character position
using the Ctrl-D key combination the value for Ctrl-D index key
(element number 136) must map to the right arrow key (element
number 77). The initialization of the Ctrl-D key for KeyTable[136]
would be 77.
LeftArr will move the cursor left one character position on
the screen until the StCol is reached. If the
beginning of the string has not been reached the
string will be scrolled on the screen within the
StCol and SpCol boundaries.
RightArr will move the cursor right one character position on
the screen until the end of the string is reached.
If the cursor is in the SpCol and there is still
more in the string that can be displayed the string
will then be scrolled within the StCol and SpCol
boundaries.
Home will place the cursor in the StCol on the screen and
positioned under the first character in the edit
string.
End will position the cursor after the last character in
the edit string.
BackSpace If the StCol is displaying the first character in
the string being edited the cursor will move to the
left one column and delete the character in that
column. If the character being displayed in the
StCol is not the first character in the string being
edited the cursor will remain in the same column
position and delete the character to the left of the
cursor and pull the string towards the cursor.
Esc will blank the string currently in the field. If
the field is already blank the procedure will
restore the string that was passed to this
procedure.
Tab will move the cursor to the right five column
positions if the SpCol has not been reached. If the
StCol has been reached then the string display will
be shifted right.
..page
^LeftArrow will move the cursor to the left five column
positions if the StCol has not been reached. If the
cursor is in the StCol then only the display string
will be adjusted to reflect the movement of the
cursor.
Del removes the character the cursor is under and
decrements the string length by one. All the
characters to the right of the cursor position are
moved left one position within the string and
display area.
Ctrl-X will delete all characters from the current string
position to the end of the string. All deleted
characters will be replaced with the FillCh that was
specified when calling this procedure.
■ Example
Program Example;
Uses FPVideo;
Const
TCSet : TSet = [1,13,72,80];
VCSet : TSet = [32..255];
Var
St : String;
TE,ChOfs : Integer;
Begin
FillChar( St, SizeOf( St ), 0 );
ChOfs := 1;
TE := 0;
EditSt(5,10,20,30,2,7,0,5000,5000,VCSet,TCSet,ChOfs,TE,St);
End.
This example will edit a string of up to thirty characters into St.
The screen will display each character as entered starting in column
ten on row five. The display area of the screen goes from columns
ten to twenty and will do a horizontal scroll in that area when the
eleventh character is entered.
All alphabetic characters, ['a'..'z'], will automatically be
converted to upper case.
The keys that will terminate this procedure are the Esc, Enter, Up
and Down Arrow keys. TE will return the proper terminating element
number as given in appendix C.
..page
..head03AFillColAttr
■ Description
Display a column of attribute bytes on the screen.
■ Summary
Procedure FillColAttr( x, y, NRows, Attr : Integer );
x defines column to begin display of attribute.
y defines row to begin display of attribute.
NRows integer in the range 1-25 for the number of rows to
display the attribute byte on.
Attr integer in the range 0-255. It is the attribute byte to
be displayed on the screen.
■ Remarks
FillColAttr always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillColCell, FillColChar
■ Example
Program Example;
Uses FPVideo;
Var
i : Integer;
Begin
ClrWin( 1, 1, 80, 25, 7 );
For i := 1 To 80 Do
FillColAttr( i, 1, 20, 48+i );
GetKey();
End.
In this example the attribute 48+i will be displayed twenty times in
each column of the display starting on row one of the screen.
..page
..head03AFillColCell
■ Description
Fill a column on the screen with a character.
■ Summary
Procedure FillColCell( x, y, NRows : Integer; Cell : Word );
x defines column to begin display of data.
y defines row to begin display of data.
NRows integer in the range 1-25 for the number of rows to
display the character and attribute bytes on the screen.
Cell integer in the range 0-0xffff. This is the character
and attribute word combination where the high order byte
is the character and the low order byte is the attribute
to be displayed.
■ Remarks
FillColCell always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillColAttr, FillColChar
■ Example
Program Example;
Uses FPVideo;
Var
i : Integer;
Begin
For i := 1 To 80 Do
FillColCell( i, 1, 20, ( (65+i) Shl 8 ) + 48+i );
End.
In this example the character is ordinal value of 'A' plus i and
attribute value is 48+i. The character attribute cell combination
will be displayed twenty times in each column of the display
starting on row one of the screen.
..page
..head03AFillColChar
■ Description
Fill a column on the screen with a character.
■ Summary
Procedure FillColChar( x, y, NRows : Integer; Ch : Char );
x defines column to begin display of character.
y defines row to begin display of character.
NRows integer in the range 1-25 for the number of rows to
display the character on.
Ch char in the range 0-255. It is the character to be
displayed on the screen.
■ Remarks
FillColChar always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillColAttr, FillColCell
■ Example
Program Example;
Uses FPVideo;
Var
i : Integer;
Begin
For i := 1 To 80 Do
FillColChar( i, 1, 20, Chr( 64+i ) );
End.
In this example the character '@'+i will be displayed twenty times
in each column of the display starting on row one of the screen.
..page
..head03AFillFrameAttr
■ Description
Fill the frame area defined by x1,y1,x2,y2 coordinates with the
attribute byte defined.
■ Summary
Procedure FillFrameAttr( x1, y1, x2, y2, Attr : Integer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Attr integer in the range 0-255. It is the attribute to be
displayed on the screen in the specified frame area.
■ See Also
FillFrameCell, FillFrameChar
■ Example
Program Example;
Uses FPVideo;
Begin
FillFrameAttr( 1, 1, 80, 25, 48 );
End.
FillFrameAttr in this example will, on a color display, make the
background color cyan and all display characters black for the
foreground color.
..page
..head03AFillFrameCell
■ Description
Fill the frame area defined by x1,y1,x2,y2 coordinates with the cell
defined.
■ Summary
Procedure FillFrameCell( x1, y1, x2, y2 : Integer; Cell : Word );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Cell integer in the range 0-255. This is the character and
attribute word combination where the high byte is the
character and the low byte is the attribute for the cell
to be displayed on the screen in the specified frame
area.
■ See Also
FillFrameAttr, FillFrameChar
■ Example
Program Example;
Uses FPVideo;
Begin
FillFrameCell( 1, 1, 80, 25, $2007 );
End.
FillFrameCell in this example will move spaces to every character
byte on the screen and the attribute byte will get the decimal
character 07. This call will have the same effect as a cls from DOS.
..page
..head03AFillFrameChar
■ Description
Fill the frame area defined by x1,y1,x2,y2 coordinates with the
character byte defined.
■ Summary
Procedure FillFrameChar( x1, y1, x2, y2 : Integer; Ch : Char );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Ch character that will be displayed on the screen in the
specified frame area.
■ See Also
FillFrameAttr, FillFrameCell
■ Example
Program Example;
Uses FPVideo;
Begin
FillFrameChar( 1, 1, 80, 25, ' ' );
End.
FillFrameChar in this example will move spaces to every character
byte on the screen. It will have almost the same effect as a ClrScr
call.
..page
..head03AFillRowAttr
■ Description
Write N copies of the attribute byte on the screen starting at the
specified x,y coordinates.
■ Summary
Procedure FillRowAttr( x, y, NBytes, Attr : Integer );
x defines column to begin display of attribute byte.
y defines row to begin display of attribute byte.
NBytes gives number of times to display the attribute byte on
the screen.
Attr integer in the range 0-255. It is the attribute byte to
be displayed on the screen.
■ Remarks
FillRowAttr always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillRowCell, FillFrameChar
■ Example
Program Example;
Uses FPVideo;
Begin
FillRowAttr( 1, 1, 80, 48 );
End.
In this example, starting at row one, column one of the screen, the
color attribute byte 48 will be used.
..page
..head03AFillRowCell
■ Description
Write N copies of the character and attribute byte on the screen
starting at the specified x,y coordinates.
■ Summary
Procedure FillRowCell( x, y, NWords : Integer; Cell : Word );
x defines column to begin display of cell word.
y defines row to begin display of cell word.
NWords gives the number times to display the character and
attribute bytes on the screen.
Cell character and attribute bytes to be displayed on the
screen.
■ Remarks
FillRowCell always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillRowAttr, FillFrameChar
■ Example
Program Example;
Uses FPVideo;
Begin
FillRowCell( 1, 1, 80, ( Ord( '-' ) Shl 8 ) + 7 );
End.
In this example eighty minus sign characters will be displayed
starting on row one, column one of the screen. The attribute value
is 7.
..page
..head03AFillRowChar
■ Description
Write N copies of the character byte on the screen starting at the
specified x,y coordinates.
■ Summary
Procedure FillRowChar( x, y, NBytes : Integer; Ch : Char );
x defines column to begin display of character.
y defines row to begin display of character.
NBytes gives number of times to display the character on the
screen.
Ch value in the range 0-255. It is the character to be
displayed on the screen.
■ Remarks
FillRowChar always acts on the entire screen and is NOT sensitive to
Turbo's currently defined window.
■ See Also
FillRowAttr, FillFrameCell
■ Example
Program Example;
Uses FPVideo;
Begin
FillRowChar( 1, 1, 80, '-' );
End.
In this example eighty minus sign characters will be displayed
starting on row one, column one of the screen.
..page
..head03AFrameWin
■ Description
Frames the window currently defined by the global variables WindMax
and WindMin with the specified characters.
■ Summary
Procedure FrameWin( UL, UR, LL, LR, Hor, Ver : Char;
Attr : Integer );
UL character in upper left corner of the window.
UR character in upper right corner of the window.
LL character in lower left corner of the window.
LR character in lower right corner of the window.
Hor horizontal character for top and bottom rows of the
window.
Ver vertical character for the left and right columns of the
window.
Attr attribute color to use for the window frame display.
■ Remarks
FrameWin will outline the window that is currently defined by the
global variables WindMin and WindMax with the characters passed.
The coordinates given by WindMin and WindMax are used to frame the
window area.
Once the window frame has been displayed WindMin and WindMax will be
adjusted so the window will fit within the framed area. (e.g. if if
the current window is defined as 1,1,80,25 then after FrameWin the
current window will be 2,2,79,24).
..page
■ Example
Program Example;
Uses FPVideo;
Begin
WindowFP( 1, 1, 80, 25 );
FrameWin( '-', '-', '-', '-', '-', '|', 7 );
End.
The above statement will use minus signs for the top and bottom
lines and the single bar for the two sides. The frame will be normal
color.
■ Example
Program Example;
Uses FPVideo;
Begin
WindowFP( 1, 1, 80, 25 );
FrameWin( 'L', 'R', 'l', 'r', 'H', 'V', 48 );
End.
The frame this statement will draw is shown below; the color for the
frame of the window is attribute value 48.
LHHHHHHHHHHHHHHHHHHHHHHHHHHR
V V
V V
V V
V V
V V
V V
V V
lHHHHHHHHHHHHHHHHHHHHHHHHHHr
..page
..head03AGetCursorSize
■ Description
Reports the starting and ending scan lines of the current cursor.
■ Summary
Function GetCursorSize : Word;
■ Remarks
Gets the cursor size by reporting the starting scan line in the high
byte and the ending scan line in the low byte of the word.
High byte -- starting scan line
Low byte -- ending scan line
■ Example
Program Example;
Uses FPVideo;
Begin
Writeln( (GetCursorSize Shr 8):5,(GetCursorSize And $00ff):5 );
End.
This example will print on one line the current starting scan line
and ending scan line respectively.
■ See Also
SetCursorSize
■ Example
j = GetCursorSize();
In this example j will receive the starting and ending scan line of
the cursor where:
hi byte - starting scan line
lo byte - ending scan line
..page
..head03AGetFrameAttr
■ Description
Read the attribute bytes for the specified area on the screen into
the buffer area.
■ Summary
Procedure GetFrameAttr( x1, y1, x2, y2 : Integer; Var Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data area where data from screen will be placed.
■ See Also
GetFrameCell, GetFrameChar
■ Example
Program Example;
Uses FPVideo;
Var
Buffer : Array[1..2000] Of Char;
i : Integer;
Begin
GetFrameAttr( 1, 1, 80, 25, Buffer );
End.
This example will read the 2000 attribute bytes from the screen and
place every byte that is read into its corresponding byte position
in the buffer array.
..page
..head03AGetFrameCell
■ Description
Read the character and attributes bytes for the specified area on
the screen into the buffer area.
■ Summary
Procedure GetFrameCell( x1, y1, x2, y2 : Integer; Var Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data area where data from screen will be placed.
■ See Also
GetFrameAttr, GetFrameChar
■ Example
Program Example;
Uses FPVideo;
Var
Buffer : Array[1..4000] Of Char;
i : Integer;
Begin
GetFrameCell( 1, 1, 80, 25, Buffer );
End.
This example will read the 4000 character and attribute bytes from
the screen and place every byte that is read into its corresponding
character attribute byte position in the buffer array.
..page
..head03AGetFrameChar
■ Description
Read the character bytes for the specified area on the screen into
the buffer area.
■ Summary
Procedure GetFrameChar( x1, y1, x2, y2 : Integer; Var Buffer );
x1 left column of window.
y1 top row of window.
x2 right column of window.
y2 bottom row of window.
Buffer data area where data from screen will be placed.
■ See Also
GetFrameAttr, GetFrameCell
■ Example
Program Example;
Uses FPVideo;
Var
Buffer : Array[1..2000] Of Char;
i : Integer;
Begin
GetFrameChar( 1, 1, 80, 25, Buffer );
End.
This example will read the 2000 characters from the screen and place
every character that is read into its corresponding character
position in the buffer array.
..page